package per.turtle.system.feign.fallback;

import lombok.Setter;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestParam;
import per.turtle.common.core.web.entity.CommonResult;
import per.turtle.system.feign.RemoteScopeService;

import java.util.List;

/**
 * 数据权限服务降级处理
 *
 * @author turtle
 */
@Slf4j
@Component
public class RemoteScopeFallbackImpl implements RemoteScopeService {

    @Setter
    private Throwable cause;

    @Override
    public CommonResult<List<String>> getDeptIdsByRole(@RequestParam String roleId) {
        log.error("系统服务调用失败:{}", cause.getMessage());
        return CommonResult.error("部门id列表获取失败:" + cause.getMessage());
    }

    @Override
    public CommonResult<List<String>> getDeptIdsWithChildByUser(String deptId) {
        log.error("系统服务调用失败:{}", cause.getMessage());
        return CommonResult.error("部门id列表获取失败:" + cause.getMessage());
    }

}
